<template>
  <div class="head-title">

    <van-row class="Navbar">

      <van-col span="4" @click="goDown()">
        <!-- <van-icon name="down" size="20px"  class="Down"/> -->
        <img :src="this.urlIcon" class="Down" />
      </van-col>

      <van-col span="12">
          <van-search v-model="commit" placeholder="请输入电影名称" />
      </van-col>
      <van-col span="4">
          <!-- <van-button type="primary" size="small" >搜索</van-button> -->
          <span class="name color"  v-if="commit.length > 0 "   @click="Search()" >搜索</span>
      </van-col>

      <van-col span="4" @click="goPerson()">
        <span class="name" >{{name}}</span>
        <!-- <van-icon name="friends-o" size="20px" class="Personlogo" /> -->
      </van-col>
    </van-row>

  </div>
</template>

<script>

import { Locale } from "vant";
import enUS from "vant/lib/locale/lang/en-US";

export default {
  name: "app-header",
  data() {
    return {
      name:'',
      pwd:'',
      commit:'',
      urlIcon: require("@/assets/Image/down.png"),
    };
  },
  methods: {
    goWorkAdd() {
      this.$router.push({
        // path: "/FunApproL",
        query: {
          // AnualID: this.AnualID,
          // title: "add"
        }
      });
    },
    goPerson(){
      const PWD = sessionStorage.getItem('PWD');
      if(PWD != null){
            this.$router.push({
              path: "/percenter",
            });
      }else{
           this.$router.push({
              path: "/login",
            });
      }

    },
     //
    Search() {
        this.$router.push({
          path: "/overWorkList",
          query: {
             typeid: 0,
             titleName: this.commit
          }
        });
      // console.log('s'
      // let Data = {
      //   typeid:0,
      //   titleName:this.commit
      // }
      // console.log(Data);

      // this.$axios({
      //   method: "get",
      //   url: "/api/User/GetAllFilesByType",
      //   // data:Data
      //    params: {
      //     titleName: this.commit,
      //     typeid:0
      //   }
      // })
      //   .then(res => {
      //     // debugger
      //     if (res.data.code === 0) {

      //     }
      //     if (res.data.Code == 1) {
      //       this.$toast({
      //         duration: 800,
      //         message: res.data.Message
      //       });
      //     }
      //   })
      //   .catch(err => {
      //     console.log(err);
      //   });
    },

    goDown(){
      this.$router.push({
        path: "/down",
      });
    },
  },

  created() { },
  mounted(){
     const PWD = JSON.parse(sessionStorage.getItem('PWD'));
     this.pwd = PWD;

     if(PWD != null){
          this.name = PWD.loginName
     }else{
          this.name = '登录'  
     }
  }
};
</script>

<style lang="less" scoped>
.head-title {
  width: 100%;
  height: 40px;
  //   background: #1ab7ea;
  position: absolute;
  top: 0;
  left: 0;
  margin-bottom: 20px;
 
  .name{
    font-size: 10px  !important ;
    margin-right: 10px;
    color: #fff;
    padding: 5px 10px;
    background-color: #99CC33;
    border-radius:3px ;
    height: 40px;
  }
  .color{
     background-color: #FF9999;
  }
  .Navbar{
    height: 50px;
  }
  .Down{
    // line-height: 90px;
    padding: 10px;
    height: 25px;
  }
}
</style>

